package com.soso.confidant.action;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;

public class TestAction implements ServletRequestAware,ServletResponseAware{
	
	private HttpServletRequest request;
	private HttpServletResponse response;
	
	public String execute() throws IOException {
		PrintWriter out = response.getWriter();
		request.getSession().setAttribute("islogin", 1);
		request.getSession().setAttribute("openid", "F08332A45A14FEC1CFFA452E4E6FCACE");
		request.getSession().setAttribute("nickname", "Lamb金氧");
		response.setContentType("text/html");
		out.println("<script>");
		out.println("window.opener.location.reload();");
		out.println("window.close();");
		out.println("</script>");
		out.flush();
		out.close();
		return null;
	}
	
	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}
	public void setServletResponse(HttpServletResponse response) {
		this.response = response;
	}
}
